package com.efeichong.project.domain.vo;

import com.efeichong.mapping.Mapping;
import com.efeichong.mapping.UseMode;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.Pattern;
import java.util.ArrayList;
import java.util.List;

/**
 * @author lxk
 * @date 2020/12/10
 * @description
 */
@Setter
@Getter
public class UserInfoVo extends SysUserVo {
    @ApiModelProperty("角色id")
    @Mapping(poProperty = "sysRoles.id")
    private List<Long> roleIds = new ArrayList<>();

    @ApiModelProperty("岗位id")
    @Mapping(poProperty = "sysPosts.id")
    private List<Long> postIds = new ArrayList<>();

    @ApiModelProperty("部门id")
    @Mapping(poProperty = "sysDepts.id")
    private List<Long> deptIds = new ArrayList<>();

    @ApiModelProperty("部门数组")
    @Mapping(poProperty = "sysDepts", useMode = UseMode.TO_VO)
    private List<SysDeptVo> deptVos;

    @ApiModelProperty("角色数组")
    @Mapping(poProperty = "sysRoles", useMode = UseMode.TO_VO)
    private List<SysRoleVo> roleVos;

    @ApiModelProperty("岗位数组")
    @Mapping(poProperty = "sysPosts", useMode = UseMode.TO_VO)
    private List<SysPostVo> postVos;

    @Pattern(regexp = "^((?=.*\\d)(?=.*[A-Z])(?=.*[a-z])|(?=.*\\d)(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9])).{8,30}$", message = "密码必须8位以上且包含大小写字母及数字组合")
    @ApiModelProperty("登录密码")
    private String password;
}
